<!DOCTYPE html>
<html>
<head>
    <meta name="layout" content="main" />
    <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no">
    <g:set var="entityName" value="${message(code: 'estate.label', default: 'Estate')}" />
    <title>交通运输工具类押品详情</title>
    <asset:stylesheet src="intelligence/swiper.css"/>
    <style>
    .contact-stat{
        padding: 8px 0px;
        text-align: center;
    }
    .contact-stat span{
        font-size: 13px;
        color: #88898c;
        margin-bottom: 10px;
    }
    .contact-stat strong{
        font-size: 13px;
        word-wrap: break-word;
    }
    .nav-tabs{
        border-bottom: none;
    }
    .hpanel > .panel-footer, .hpanel > .panel-section{
        background: #f9f9f9;
    }
    .flex{
        display: flex;justify-content: center;align-items: center;
    }
    .newFontSize{
        font-size: 12px;
    }
    table>tbody>tr>td, table>tbody>tr>th,.table>tfoot>tr>td, table>tfoot>tr>th, table>thead>tr>td, table>thead>tr>th{
        padding: 8px;
        line-height: 1.42857143;
        white-space: nowrap;
    }
    /*轮播图样式*/
    .swiper-container{
        width: 100%;
        height: 300px;
        margin-top: 10px;
    }
    .swiper-pagination-bullet-active{
        opacity: 0.6;
        background: #fff;
    }
    @media (max-width:1654px){
        #screenPage,#screenPage_1{
            height:162px;
        }
    }
    @media (max-width:1382px){
        #screenPage_2{
            height:477px;
        }
    }
    </style>
</head>
<body class="fixed-navbar fixed-sidebar">

<div class="small-header">
    <div class="hpanel">
        <div class="panel-body">
            <div id="hbreadcrumb" class="pull-right navFloatRight">
                <ol class="hbreadcrumb breadcrumb">
                    <li>
                        <span>CINDATA PLS</span>
                    </li>
                    <li>
                        <span>
                            <g:link action="index">交通运输工具</g:link>
                        </span>
                    </li>
                    <li class="active">
                        <span>交通运输工具详情</span>
                    </li>
                </ol>
            </div>
        </div>
    </div>
</div>

<div class="content animate-panel">
    %{--押品信息--}%
    <div class="row">
        <div class="hpanel hgreen" style="">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a href="${this?.collateral?.id}" class="btn btn-xs btn-success handleButton">评估</a>
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                押品信息
            </div>

            <div class="panel-body">
                <div class="col-md-12 text-center">
                    <div class="col-md-3">
                        <h3 class="font-extra-bold m-b-xs text-center">
                            <small style="font-size: 16px;">最新评估价值 :</small>
                            <span class="totalPrice">${collateral?.totalPrice?collateral?.totalPrice/10000:'-'}</span>
                            <small class="newFontSize">万元</small>
                        </h3>
                    </div>
                    <div class="col-md-3">
                        <h3 class="font-extra-bold m-b-xs">
                            <small style="font-size: 16px;">抵质押率 : </small>
                            <g:formatNumber number="${vehicleDetail?.ltv?vehicleDetail?.ltv*100:0}" type="number" minFractionDigits="2" maxFractionDigits="2" />%
                            <small class="newFontSize"></small>
                        </h3>
                    </div>
                    <div class="col-md-3">
                        <h3 class="font-extra-bold m-b-xs">
                            <small style="font-size: 16px;">变现能力 : </small>
                            ${vehicleDetail?.cashability?vehicleDetail?.cashability.name:'-'}
                            <small class="newFontSize"></small>
                        </h3>
                    </div>
                    <div class="col-md-3">
                        <h3 class="font-extra-bold m-b-xs text-center">
                            <small style="font-size: 16px;">押品风险 : </small>
                            <g:if test="${vehicleDetail?.cltv>=0&&vehicleDetail?.cltv<=0.6}"><span style="color: #62CB31">低</span></g:if>
                            <g:if test="${vehicleDetail?.cltv>0.6&&vehicleDetail?.cltv<=0.8}"><span style="color: #FF9800">中</span></g:if>
                            <g:if test="${vehicleDetail?.cltv>0.8&&vehicleDetail?.cltv<=1}"><span style="color: #E51C23">高</span></g:if>
                            <g:if test="${vehicleDetail?.cltv>1}"><span style="color: #8B1818">损失</span></g:if></h4>
                        </h3>
                    </div>
                </div>
            </div>

            <div class="panel-footer contact-footer">
                <div class="row">
                    <div class="col-md-1" style="width: 20%">
                        <div class="contact-stat">
                            <span>押品编号</span>
                            <strong>${vehicleDetail?.externalId}</strong>
                        </div>
                    </div>
                    <div class="col-md-1" style="width: 20%">
                        <div class="contact-stat">
                            <span>抵押品类型</span>
                            <strong>${vehicleDetail?.type?.name}</strong>
                        </div>
                    </div>
                    <div class="col-md-1" style="width: 20%">
                        <div class="contact-stat">
                            <span>抵押人名称</span>
                            <strong>${vehicleDetail?.fullName}</strong>
                        </div>
                    </div>

                    <div class="col-md-1" style="width: 20%">
                        <div class="contact-stat">
                            <span>押品状态</span>
                            <strong>${vehicleDetail?.estateStatus?.name}</strong>
                        </div>
                    </div>


                    <div class="col-md-1" style="width: 20%">
                        <div class="contact-stat">
                            <span>城市</span>
                            <strong>${vehicleDetail?.city?.name}</strong>
                        </div>
                    </div>

                </div>
            </div>
        </div>
    </div>
    %{--押品信息--}%
    <div class="row">
        <div class="hpanel hgreen" style="">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                押品详细信息
            </div>

            <div class="panel-body no-padding" style="overflow-x:scroll;">
                <table class="table table-striped table-bordered table-hover text-center">
                    <thead>
                    <tr>
                        <th>抵押物编号</th>
                        <th>抵押物类型</th>
                        <th>抵押物名称</th>
                        <th>抵押人名称</th>
                        <th>抵押人证件类型</th>
                        <th>抵押人证件号码</th>
                        <th>抵押人贷款卡编号</th>
                        <th>其他共同所有人</th>
                        <th>所占份额</th>
                        <th>此抵押物是否当前申请所购资产</th>
                        <th>抵押权顺位</th>
                        <th>在先担保金额</th>

                        <th>抵押物品牌</th>
                        <th>制造厂家</th>
                        <th>型号</th>
                        <th>发动机号码</th>
                        <th>抵押登记证书编号</th>
                        <th>生产日期</th>
                        <th>购置日期</th>
                        <th>购置价格</th>
                        <th>币种</th>
                        <th>使用情况</th>
                        <th>承租人</th>
                        <th>租赁起始日期</th>
                        <th>租赁到期日期</th>
                        <th>日租金（元）</th>
                        <th>变现能力</th>
                        <th>价值波动性</th>
                        <th>查封便利性</th>
                        <th>抵质押物与借款人相关性</th>
                        <th>法律有效性</th>
                        <th>初次评估价值</th>
                        <th>初次评估机构</th>
                        <th>最新评估价值</th>
                        <th>最新评估机构</th>
                        <th>最新评估日期</th>
                        <th>下次评估日期</th>
                        <th>实际抵质押率</th>
                        <th>抵质押率上限</th>
                        <th>抵质押物说明</th>

                        <th>登记人</th>
                        <th>登记机构</th>
                        <th>登记日期</th>
                        <th>更新日期</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td>${vehicleDetail?.externalId}</td>
                        <td>${vehicleDetail?.type?vehicleDetail?.type.name:'-'}</td>
                        <td>${vehicleDetail?.name?vehicleDetail?.name:'-'}</td>
                        <td>${vehicleDetail?.fullName?vehicleDetail?.fullName:'-'}</td>
                        <td>${vehicleDetail?.identityType?vehicleDetail?.identityType.name:'-'}</td>
                        <td>${vehicleDetail?.idNumber?vehicleDetail?.idNumber:'-'}</td>
                        <td>${vehicleDetail?.loanCardNumber?vehicleDetail?.loanCardNumber:'-'}</td>
                        <td>${vehicleDetail?.commonOwnerFullName?vehicleDetail?.commonOwnerFullName:'-'}</td>
                        <td>${vehicleDetail?.sharePoint?vehicleDetail?.sharePoint:'-'}</td>
                        <td>${vehicleDetail?.isApplayPurchaseAsset?'是':'否'}</td>
                        <td>${vehicleDetail?.rightOfMortgage?vehicleDetail?.rightOfMortgage:'-'}</td>
                        <td>${vehicleDetail?.firstGuaranteedAmount?vehicleDetail?.firstGuaranteedAmount:'-'}</td>
                        <td>${vehicleDetail?.brand?vehicleDetail?.brand:'-'}</td>
                        <td>${vehicleDetail?.manufacturer?vehicleDetail?.manufacturer:'-'}</td>
                        <td>${vehicleDetail?.model?vehicleDetail?.model:'-'}</td>
                        <td>${vehicleDetail?.engineNumber?vehicleDetail?.engineNumber:'-'}</td>
                        <td>${vehicleDetail?.mortgageRegisterNo?vehicleDetail?.mortgageRegisterNo:'-'}</td>
                        <td>${vehicleDetail?.releaseDate?vehicleDetail?.releaseDate:'-'}</td>
                        <td>${vehicleDetail?.purchaseDate?vehicleDetail?.purchaseDate:'-'}</td>
                        <td>${vehicleDetail?.purchasePrice?vehicleDetail?.purchasePrice:'-'}</td>
                        <td>${vehicleDetail?.currency?vehicleDetail?.currency.name:'-'}</td>
                        <td>${vehicleDetail?.usage?vehicleDetail?.usage:'-'}</td>
                        <td>${vehicleDetail?.lessee?vehicleDetail?.lessee:'-'}</td>
                        <td>${vehicleDetail?.leaseStartDate?vehicleDetail?.leaseStartDate:'-'}</td>
                        <td>${vehicleDetail?.leaseEndDate?vehicleDetail?.leaseEndDate:'-'}</td>
                        <td>${vehicleDetail?.dailyRents?vehicleDetail?.dailyRents:'-'}元</td>
                        <td>${vehicleDetail?.cashability?vehicleDetail?.cashability.name:'-'}</td>
                        <td>${vehicleDetail?.valueVolatility?vehicleDetail?.valueVolatility:'-'}</td>
                        <td>${vehicleDetail?.seizureOfConvenience?vehicleDetail?.seizureOfConvenience:'-'}</td>
                        <td>${vehicleDetail?.relationOfMortgagor?vehicleDetail?.relationOfMortgagor:'-'}</td>
                        <td>${vehicleDetail?.legalValidity?vehicleDetail?.legalValidity:'-'}</td>
                        <td>${vehicleDetail?.firstEvaluatePrice?vehicleDetail?.firstEvaluatePrice:'-'}</td>
                        <td>${vehicleDetail?.firstEvaluateAccount?vehicleDetail?.firstEvaluateAccount:'-'}</td>
                        <td>${vehicleDetail?.latestEvaluatePrice?vehicleDetail?.latestEvaluatePrice:'-'}</td>
                        <td>${vehicleDetail?.latestEvaluateAccount?vehicleDetail?.latestEvaluateAccount:'-'}</td>
                        <td>${vehicleDetail?.latestEvaluateDate?vehicleDetail?.latestEvaluateDate:'-'}</td>
                        <td>${vehicleDetail?.nextEvaluateDate?vehicleDetail?.nextEvaluateDate:'-'}</td>
                        <td>${vehicleDetail?.actualMortgageRate?vehicleDetail?.actualMortgageRate:'-'}</td>
                        <td>${vehicleDetail?.mortgageRateUpperLimit?vehicleDetail?.mortgageRateUpperLimit:'-'}</td>
                        <td>${vehicleDetail?.description?vehicleDetail?.description:'-'}</td>
                        <td>${vehicleDetail?.registerFullName?vehicleDetail?.registerFullName:'-'}</td>
                        <td>${vehicleDetail?.registerAccount?vehicleDetail?.registerAccount:'-'}</td>
                        <td>${vehicleDetail?.registerDate?vehicleDetail?.registerDate:'-'}</td>
                        <td>${vehicleDetail?.registerUpdateDate?vehicleDetail?.registerUpdateDate:'-'}</td>
                    </tr>
                    </tbody>
                </table>
            </div>

        </div>
    </div>
    %{--贷款信息--}%
    <div class="row">
        <div class="hpanel hgreen" style="">
            <div class="panel-heading">
                <div class="panel-tools">
                    <a class="showhide"><i class="fa fa-chevron-up"></i></a>
                </div>
                贷款信息
            </div>

            <div class="panel-body no-padding" style="overflow-x:scroll;">
                <table class="table table-striped table-bordered table-hover text-center">
                    <thead>
                    <tr>
                        <th>贷款编号</th>
                        <th>贷款余额</th>
                        <th>贷款总额</th>
                        <th>成交总价</th>
                        <th>回收总本金</th>
                        <th>回收总利息</th>
                        <th>回收总罚息</th>
                        <th>当前还款状态</th>
                        <th>逾期期数</th>
                        <th>抵押权人</th>
                        <th>担保机构</th>
                        <th>放款银行</th>
                        <th>贷款时评估总价</th>
                        <th>贷款时评估单价</th>
                        <th>贷款到期日</th>
                        <th>贷款放款日</th>
                        <th>剩余还款总期数</th>
                        <th>还款方式</th>
                        <th>抵押率</th>
                    </tr>
                    </thead>
                    <tbody>
                    <g:each in="${mortgageList}">
                        <tr>
                            <td ><g:link class="firstTd" style="color: #3498DB" action="show" controller="mortgage" id="${it?.id}">${it?.serialNumber?it?.serialNumber:'-'}</g:link></td>
                            <td>${it?.loansBalance?it?.loansBalance:'-'}元</td>
                            <td>${it?.loansAmount?it?.loansAmount:'-'}元</td>
                            <td>
                                <g:if test="${it?.loansEvaluateTotalPrice}">
                                    ${com.cindata.NumberUtil.GetFixedNumber(it?.loansEvaluateTotalPrice/10000)}（万元）
                                </g:if>
                                <g:else>
                                    -
                                </g:else>
                            </td>
                            <td>${it?.curRecycleTotalCapital?it?.curRecycleTotalCapital:'-'}元</td>
                            <td>${it?.curRecycleTotalInterest?it?.curRecycleTotalInterest:'-'}元</td>
                            <td>${it?.curRecycleTotalFine?it?.curRecycleTotalFine:'-'}元</td>
                            <td>${it?.curRepaymentState?it?.curRepaymentState.name:'-'}</td>
                            <td>${it?.curOverdueDuration?it?.curOverdueDuration:'-'}</td>
                            <td>${it?.mortgageeName?it?.mortgageeName:'-'}</td>
                            <td>${it?.guaranteeInstitution?it?.guaranteeInstitution.name:'-'}</td>
                            <td>${it?.loansBankName?it?.loansBankName:'-'}</td>
                            <td>${it?.loansEvaluateTotalPrice?it?.loansEvaluateTotalPrice:'-'}元</td>
                            <td>${it?.loansEvaluatePrice?it?.loansEvaluatePrice:'-'}元</td>
                            <td>
                                <g:if test="${it?.endDate}">
                                    <g:formatDate date="${it?.endDate}" format="yyyy-MM-dd"></g:formatDate>
                                </g:if>
                                <g:else>
                                    -
                                </g:else>
                            </td>
                            <td>
                                <g:if test="${it?.startDate}">
                                    <g:formatDate date="${it?.startDate}" format="yyyy-MM-dd"></g:formatDate>
                                </g:if>
                                <g:else>
                                    -
                                </g:else>
                            </td>
                            <td>${it?.remainTime?it?.remainTime:'-'}月</td>
                            <td>${it?.curRepaymentMode?it?.curRepaymentMode.name:'-'}</td>
                            <td>${it?.ltv?it?.ltv:'-'}%</td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>

        </div>
    </div>
</div>
<asset:javascript src="intelligence/swiper.js"/>
<script>
    //    $('#goBack').click(function(){
    //        window.history.back(-1);
    //    })
    var riskText=$('.risk').text();
    if(riskText=='低风险>>'){
        $('.risk').css('color','#62CB31');
    }else if(riskText=='中风险>>'){
        $('.risk').css('color','#FF9800');
    }
    else if(riskText=='高风险>>'){
        $('.risk').css('color','#E51C23');
    }else{
        $('.risk').css('color','#3498DB');
    }


</script>
<script>
    function show(id){
        var url = window.location.origin+"/mortgage/show?id="+id;
        window.open(url);
    }

</script>

<g:javascript>
    //单条评估
    $(".handleButton").click(function(event){
        event.preventDefault();
        var id = $(this).attr("href");
        swal({
            title: "确定评估该押品吗？",
            type: "warning",
            showCancelButton: true,
            confirmButtonColor: "#DD6B55",
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            closeOnConfirm: true
        },
        function(){
            $.ajax({
                url:'/valuationHistory/evaluate',
                data:{
                    ids:id,
                    sourceClass: 'vehicle'
                },
                type:"post",
                success:function(data)
                {
                    if(data.status=="success"){
                        window.location.href="/vehicle/show/" + id
                    }else{
                        swal("评估失败，请稍后重试", "", "error");
                    }
                }
            })
        });
    });
</g:javascript>
</body>
</html>
